package com.pronosticnews.server.domain.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;

@Entity
public class Image implements fr.ysa.persistence.Entity {

	private static final long serialVersionUID = -1672830458202644784L;

	public static enum TAILLE {
		NORMAL, MINI
	}
	
	public static int MIN_WIDTH_MINI = 50;	
	public static int MIN_HEIGHT_MINI = 50;
	
	public static enum TYPE {
		jpg, jpeg, png, gif
	}
	
	
	public static enum VALUE_NAME {
		id, contenu, type
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;

	private String type;

	@Lob
	@Column(length=1000000)
	private byte[] contenu;

	@Lob
	@Column(length=100000)
	private byte[] contenu_mini;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public byte[] getContenu() {
		return contenu;
	}

	public void setContenu(byte[] contenu) {
		this.contenu = contenu;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public byte[] getContenu_mini() {
		return contenu_mini;
	}

	public void setContenu_mini(byte[] contenu_mini) {
		this.contenu_mini = contenu_mini;
	}

	@Override
	public List<String> getColumnNameValues() {
		List<String> list = new ArrayList<String>();
		for (VALUE_NAME value : VALUE_NAME.values()) {
			list.add(value.name());
		}
		return list;
	}
}
